package com.seventeen.mq.proxy.common.config;

import com.seventeen.mq.proxy.common.core.redis.RedisCache;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * redis配置
 *
 * @author seventeen
 */
@Configuration
public class RedisCacheConfig
{

    @Bean
    @ConditionalOnMissingBean(RedisCache.class)
    @ConditionalOnBean(RedisTemplate.class)
    public RedisCache redisCache(RedisTemplate redisTemplate)
    {
        RedisCache redisCache = new RedisCache();
        redisCache.setRedisTemplate(redisTemplate);
        return redisCache;
    }

}
